import 'package:flutter/material.dart';

class UserPage extends StatefulWidget {
  const UserPage({super.key});

  @override
  State<UserPage> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<UserPage> {

  var walletItemAry = [{"title":"资金记录","icon":"lib/Project/Images/User/user_financial_details.png"},
                {"title":"打款订单","icon":"lib/Project/Images/User/user_payment_record.png"},
                {"title":"钱包","icon":"lib/Project/Images/User/user_wallet_icon.png"}
               ];
  var billItemAry = [{"title":"中转费","icon":"lib/Project/Images/User/user_中转费.png"},
                {"title":"派费","icon":"lib/Project/Images/User/user_派费.png"},
                {"title":"散单查询","icon":"lib/Project/Images/User/user_电子面单.png"},
                {"title":"网店报价","icon":"lib/Project/Images/User/user_网点报价.png"}
               ];
   var elseItemAry = [{"title":"我的名片","icon":"lib/Project/Images/User/user_我的名片.png"},
                {"title":"实效看板","icon":"lib/Project/Images/User/user_时效看板.png"},
                {"title":"小哥保险","icon":"lib/Project/Images/User/user_小哥保险.png"},
                {"title":"留言反馈","icon":"lib/Project/Images/User/user_电子面单.png"},
                {"title":"钉钉申请","icon":"lib/Project/Images/User/user_钉钉.png"},
                {"title":"拓店奖励","icon":"lib/Project/Images/User/user_散单服务.png"},
                {"title":"智程网监控","icon":"lib/Project/Images/User/user_zcw.png"},
                {"title":"业绩统计","icon":"lib/Project/Images/User/user_ statistics.png"},
                {"title":"网络切换","icon":"lib/Project/Images/User/user_留言反馈.png"},
                {"title":"散单服务","icon":"lib/Project/Images/User/user_order.png"}
               ];

  
    Widget _gridItemBuilder(BuildContext context,int index) {
    return Column(
      children: [
        Image.asset(elseItemAry[index]["icon"]!,width: 30,height: 30),
        Text(elseItemAry[index]["title"]!,style: TextStyle(color: Color(0xFF222222),fontSize: 12))
      ],
      );
    }

  @override
  Widget build(BuildContext context) {
     return Scaffold(
      //appBar: null,
      
      appBar: AppBar(
        title: Text('个人中心'),
      ),
      
      body: SingleChildScrollView(
        child: Column(
          children: [
            //头部
            Container(
              //color:Color(0xFF1678FF),
              height: 114,
              margin: EdgeInsets.only(top: 8,left: 12,right: 12,bottom: 8),
              child: Column(
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Container(
                        child: Row(
                          children: [
                            Text("网格长500票",style: TextStyle(fontSize: 16,color: Color(0xFF222222))),
                            SizedBox(width: 5),
                            Image.asset("lib/Project/Images/User/user_questionmark.png",width: 16,height: 16),
                            SizedBox(width: 5),
                            Text("网格长姓名",style: TextStyle(fontSize: 12,color: Color(0xFF222222))),
                            SizedBox(width: 5),
                            Image.asset("lib/Project/Images/User/user_call.png",width: 16,height: 16),
                          ],
                        ),
                      ),
                      Image.asset("lib/Project/Images/User/user_set.png",width: 24,height: 24),
                    ],
                  ),
                  SizedBox(height: 15),
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Image.asset("lib/Project/Images/User/user_common_avatar.png",width:60,height: 60),
                      SizedBox(width: 10),
                      Container(
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                
                                Container(
                                  child: Row(
                                    children: [
                                      Text("张先生",style: TextStyle(fontSize: 18,color: Color(0xFF222222))),
                                      SizedBox(width: 8),
                                      Column(
                                        children: [
                                          Text("201866 6410",style: TextStyle(fontSize: 10,color: Color(0xFF222222))),
                                          SizedBox(height: 3),
                                          Text("1234567890",style: TextStyle(fontSize: 10,color: Color(0xFF222222)))
                                        ],
                                      ),
                                    ],
                                  ),
                                ),
                                SizedBox(width: 20),

                                // Flexible (flex: 0,fit: FlexFit.tight,child:
                                Container(
                                  decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(16)),color: Colors.white),
                                  height: 20,
                                  width: 108,                                
                                  child: Row(
                                    children: [
                                      SizedBox(width: 5),
                                      Image.asset("lib/Project/Images/User/user_realname.png",width: 16,height: 16),
                                      Text("未实名认证",style: TextStyle(fontSize: 14,color: Color(0xFF222222)))
                                    ],
                                  ),
                                ),
                                //)
                              ],
                            ),
                            SizedBox(height: 5),
                            Text("韵镖侠测试网店地址韵镖侠测试网店地址",style: TextStyle(fontSize: 12,color: Color(0xFF222222)))
                          ],
                        ),
                      )
                    ],
                  )
                ],
              ),
            ),

            //钱包
            Container(
              decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(16)),color: Colors.white),
              margin: EdgeInsets.only(top: 8,left: 12,right: 12,bottom: 8),
              padding: EdgeInsets.only(top: 12),
              
              height: 120,
              child:Column(
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          SizedBox(width: 12),
                          Text("钱包",style: TextStyle(fontSize: 16,color: Color(0xFF222222),fontWeight: FontWeight.w600)),
                        ],
                      ),
                      Row(
                        children: [
                          Image.asset("lib/Project/Images/User/user_message.png",width: 18,height: 18),
                          SizedBox(width: 2),
                          Text("有文案可滚动的文案，这里是是是是最长字",style: TextStyle(fontSize: 12,color: Color(0xFF222222))),
                          SizedBox(width: 15),
                        ],
                      )
                    ],
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: [
                      for(int i = 0 ; i < walletItemAry.length; i++ )
                      Column(
                        children: [
                          SizedBox(height: 10),
                          Image.asset(walletItemAry[i]["icon"]!,width: 48,height: 48),
                          SizedBox(height: 2),
                          Text(walletItemAry[i]["title"]!,style: TextStyle(fontSize: 12,color: Color(0xFF222222))),
                        ],
                      )
                    ],
                  )
                  
                ],
              )
                
            ),


            //资产
            Container(
              decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(16)),color: Colors.white),
              margin: EdgeInsets.only(top: 0,left: 12,right: 12,bottom: 8),
              
              height: 106,
              child:Column(
                children: [
                  SizedBox(height: 12),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          SizedBox(width: 12),
                          Text("资产",style: TextStyle(fontSize: 16,color: Color(0xFF222222),fontWeight: FontWeight.w600)),
                        ],
                      ),
                    ],
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: [
                      for(int i = 0 ; i < 3; i++ )
                      Column(
                        children: [
                          SizedBox(height: 12),
                          Text("293.20$i",style: TextStyle(fontSize: 18,color: Color(0xFF222222))),
                          SizedBox(height: 5),
                          Text("剩余面单",style: TextStyle(fontSize: 12,color: Color(0xFF3B3B3B))),
                        ],
                      )
                    ],
                  )
                  
                ],
              )

            ),

            //账单
            Container( 
              decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(16)),color: Colors.white),
              margin: EdgeInsets.only(top: 0,left: 12,right: 12,bottom: 8),
              
              height: 110,
              child:Column(
                children: [
                  SizedBox(height: 12),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          SizedBox(width: 12),
                          Text("账单",style: TextStyle(fontSize: 16,color: Color(0xFF222222),fontWeight: FontWeight.w600)),
                        ],
                      ),
                    ],
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: [
                      for(int i = 0 ; i < billItemAry.length; i++ )
                      Column(
                        children: [
                          SizedBox(height: 10),
                          Image.asset(billItemAry[i]["icon"]!,width: 30,height: 30),
                          SizedBox(height: 5),
                          Text(billItemAry[i]["title"]!,style: TextStyle(fontSize: 12,color: Color(0xFF222222))),
                        ],
                      )
                    ],
                  )
                  
                ],
              )

            ),

            //其他
            Container(
              decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(16)),color: Colors.white),
              margin: EdgeInsets.only(top: 0,left: 12,right: 12,bottom: 8),
              height: 170,

              child:Column(
                children: [
                  SizedBox(height: 12),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          SizedBox(width: 12),
                          Text("其他",style: TextStyle(fontSize: 16,color: Color(0xFF222222),fontWeight: FontWeight.w600)),
                        ],
                      ),
                      Row(
                        children: [
                          Text("查看更多",style: TextStyle(fontSize: 14,color: Color(0xFF9999992))),
                          SizedBox(width: 2),
                          Image.asset("lib/Project/Images/User/user_right.png",width: 18,height: 18),
                          SizedBox(width: 5),
                        ],
                      )
                    ],
                  ),
                  SizedBox(height: 10),
                  Container(
                    height: 120,
                    //color: Colors.orange,
                    margin: EdgeInsets.only(left: 13,right: 13),
                    child:  GridView.builder(
                    scrollDirection:Axis.vertical,
                    physics: NeverScrollableScrollPhysics(),
                    gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                      crossAxisCount: 5,
                // crossAxisSpacing: 8.0,
                // mainAxisSpacing: 8.0,
                //childAspectRatio: 1,// 宽高比
                    ), 
                    itemBuilder:_gridItemBuilder,
                    //padding: EdgeInsets.all(8),
                    itemCount: elseItemAry.length,
                  ),
                ),
                
                ],
              )
            ),

            //退出登录
            Container(
              alignment: Alignment.center,
              color:Color(0xFFFFFFFF),
              height: 44,
              margin: EdgeInsets.only(top: 0,left: 12,right: 12,bottom: 8),
              child: Text("退出登录",style: TextStyle(fontSize: 14,color: Color(0xFFFF5151))),

            )

          ],
        ),
      ),
     );
  }
}